
import 'package:flutter/cupertino.dart';
import 'package:flutter_deer/util/other_utils.dart';

class FadeInText extends StatefulWidget {
  const FadeInText({Key? key,required this.text}) : super(key: key);

  final String? text;

  @override
  _FadeInTextState createState() => _FadeInTextState();
}

class _FadeInTextState extends State<FadeInText> {

  double opacity = 0.0;

  @override
  void initState(){
    super.initState();
    this.opacity = 0.0;
    Future.delayed(Duration(milliseconds: 1000),(){
      setState(() {
        this.opacity = 1.0;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return AnimatedOpacity(
      duration: Duration(seconds: 3),
      opacity: opacity,
      curve: Curves.ease,
      child: Text(widget.text.nullSafe),
    );
  }

}